"""WTF, Checks if there is something wrong with the timestamp"""

from misc import timedata
import misc.quoteperiod as qp
import system.navalasystem as na
import datetime
na.vala.flagMaster = True
na.vala.Startup()

quotes = na.vala.db.quote_GetData(qp.weekly, 
    "BOVESPA.VISTA.PETR4", datetime.datetime(1990, 1, 1), datetime.datetime.today())

print "Read %d quotes" % len(quotes)

flagFirst = True
for t in quotes.timestamp:
    if not flagFirst:
        if t <= tPrev:
            raise Exception("whattafuck!!!")
    tPrev = t
    flagFirst = False
    
print "EVERYTHING OK"

na.vala.Cleanup()
